package com.hnx.admin.api.redis;

public interface RedisAPI {
    public static final String KEY_EMPTY = "键名不能为空";
    public static final String VALUE_EMPTY = "键值不能为空";
    public static final String JSON_FAILED = "JSON序列化失败";
    public static final String  OBJECT_EMPTY = "转换对象不能为空";
    public static final String  INCR_FAILED = "递增因子必须大于或等于0";
    public static final String  PATTERN_EMPTY =  "键值通配符不能为空";
    public static final String JSON_PARSE_FAILED = "JSON解析失败，key:";
    public static final String JSON_UNKNOWN  = "解析JSON发生未知错误，key:";
    default String reason(String prefixReason,String key,String msg){
        StringBuilder sb = new StringBuilder();
        sb.append(prefixReason);
        sb.append(key);
        sb.append(",原因：");
        sb.append(msg);
        return sb.toString();
    }
    default String reason(String key,String msg){
        return reason(JSON_PARSE_FAILED,key,msg);
    }
}
